package com.game.framework.dao;

import com.game.framework.dao.entity.ActivityInfo;
import com.game.framework.dao.redis.EnumRedisKey;
import com.game.framework.dao.redis.IRedisKeyConfig;
import com.game.framework.dao.repository.ActivityInfoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class ActivityInfoDao extends AbstractDao<ActivityInfo, Long> {

	@Autowired
	protected ActivityInfoRepository activityInfoRepository;

	@Override
	protected IRedisKeyConfig getRedisKey() {
		return EnumRedisKey.Account;
	}

	@Override
	protected MongoRepository<ActivityInfo, Long> getMongoRepository() {
		return activityInfoRepository;
	}

	@Override
	protected Class<ActivityInfo> getEntityClass() {
		return ActivityInfo.class;
	}
	
	public Optional<ActivityInfo> selectActivityInfoById(Long activityId) {
		return activityInfoRepository.findById(activityId);
	}

	public List<ActivityInfo> selectAllActivityInfo() {
		return activityInfoRepository.findAll();
	}
}
